<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>订单查询</title>
	<meta name="decorator" content="default"/>
	<script src="${ctxStatic }/jquery/jquery-1.8.3.min.js"></script>
	<jsp:include page="/WEB-INF/views/modules/orders/head.jsp"></jsp:include>
	<script type="text/javascript" src="${ctxStatic }/gov/js/cityselect.js" ></script>
	<link href="${ctxStatic }/cityselector/cityselect.css" rel='stylesheet'type='text/css' />
	<script src="${ctxStatic}/js/jquery.validate.js" type="text/javascript"></script>
	<script type="text/javascript" src="${ctxStatic }/index/js/map.js"></script>
	<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=kOQ8j9rd2ATw2R54boLMFUalu3gGNGDO&s=1"></script>
	<script type="text/javascript">
	
	$(function() {
		
		if("${message}".length>0){
			alert("${message}");
		}
		 $(".every").click(function () { 
		        $(".One").removeAttr("checked");  
		 });  
		 $(".One").click(function () { 
		        $(".every").removeAttr("checked");  
		 });  
		
		// 机场
		$.post('${ctxFront}/info/site/siteJson',{spottypes:'9'}, function(data) {
			new Vcity.CitySelector({input:'departcity_sitename3',cityData:data});
		});
		// 送达城市
		$.post('${ctxFront}/info/site/siteJson',{spottypes:'0'}, function(data) {
			new Vcity.CitySelector({input:'destcity_sitename3',cityData:data});
		});
		 $('.airportRentTab').click(function(){
			$('#airportRentType').val($(this).attr('data-value'));
		}); 
	})
	
	
</script>
<style type="text/css">
input, .uneditable-input {
		height:30px !important;
	    display: inline-block;
	    padding: 4px 6px;
	    margin-bottom: 10px;
	    font-size: 14px;
	    line-height: 20px;
	    color: #555555;
	    vertical-align: middle;
	    -webkit-border-radius: 4px;
	    -moz-border-radius: 4px;
	    border-radius: 4px;
	}
	.Wdate {
	    height:30px !important;
	    border: #999 1px solid;
	    background: #fff url(datePicker.gif) no-repeat right ;
	    background-color: rgb(255, 255, 255);
	}

</style>
<script type="text/javascript">
//接送机提交
var km = 0;
var time = 0;
$(function(){
	$("#airportsearch").click(function(){
		if($('#departcity_sitename3').val()=="") {
			alert("机场不能为空");
			return false;
		}
		if($('#destcity_sitename3').val()=="") {
			alert("城市不能为空");
			return false;
		}
		if($('#suggestId').val()=="") {
			alert("请输入详细地址");
			return false;
		}
		if($('#before').val()=="") {
			alert("请输入出发日期");
			return false;
		}
		if($('#end').val()=="") {
			alert("请输入截止日期");
			return false;
		}
		if($('#deptime').val()=="") {
			alert("请输入出发时间");
			return false;
		}
		if($('#allprice').val()=="") {
			alert("请输入总金额");
			return false;
		}
		if($('#minamount').val()=="") {
			alert("请输入成团人数");
			return false;
		}
		if($('#maxamount').val()=="") {
			alert("请输入最大参与人数");
			return false;
		}
		if($('#contacts').val()=="") {
			alert("请输入联系人");
			return false;
		}
		if($('#phone').val()=="") {
			alert("请输入联系方式");
			return false;
		}
		var x= $('#suggestId').val();
		var y = $('#departcity_sitename3').val()
		var map = new BMap.Map("allmap");
var output = "从"+y+"到"+x+"驾车预计需要";
var searchComplete = function (results){
	if (transit.getStatus() != BMAP_STATUS_SUCCESS){
		return ;
	}
	var plan = results.getPlan(0);
	output += plan.getDuration(true) + "\n";                //获取时间
	time = plan.getDuration(true);
	$('#maptime').val(time)
	output += "总路程大约为：" ;
	output += plan.getDistance(true) + "\n";             //获取距离
	km = plan.getDistance(true);
	$('#mapkm').val(km);
}
var transit = new BMap.DrivingRoute(map, {renderOptions: {map: map},
	onSearchComplete: searchComplete,
	onPolylinesSet: function(){        
		//$("#distance").html(output);
		$("#mes").val(output);
}});
transit.search(x, y);
window.setTimeout(submitform, 1500); 
function submitform() 
{	
	var $time = $("#before").val()+" "+$("#deptime").val();
	$.post("${ctxFront}/sms/checkTime","time="+$time,function(d){
		if(d==1){//"距离发车时间不足2小时，请重新选择发车时间"
			alert("距离发车时间不足2小时，请重新选择出发时间");
			return false;
		}else{
			$('#airportRentForm').submit();
		}
	});
} 
})
	})
</script>

</head>
<body>
<ul class="nav nav-tabs">
		<li ><a href="${ctx}/orders/shareProduct/allShareList">有效拼车</a></li>
		<li ><a href="${ctx}/orders/shareProduct/expireShareList">未成功拼车</a></li>
		<li class="active"><a href="javascript:void(0)">添加</a></li>
	</ul>
	<div class="form-horizontal">
	<div class="control-group">
	<label class="control-label">选择发布类型：</label>
		<div class="controls">
			<form  action="${ctx}/orders/shareProduct/addShareProduct" style="display:inline;">
				<input type="hidden" name="type" value="0"/>
				<input type="submit"  value="切换至旅游拼车发布" id="btnSubmit" class="btn btn-primary"/>
			</form>
			<form  action="${ctx}/orders/shareProduct/addShareProduct" style="display:inline;">
				<input type="hidden" name="type" value="2"/>
				<input type="submit"  value="切换至城际拼车发布" id="btnSubmit" class="btn btn-primary"/>
			</form>
		</div>
	</div>
	</div>
	<form action="${ctx}/orders/shareProduct/jsjCar" class="form-horizontal" method="post" id="airportRentForm">
		<input type="hidden" name="mapkm" value="" id="mapkm"/>
		<input type="hidden" name="maptime" value="" id="maptime"/>
		<div class="control-group">
			<label class="control-label">接送机类型：</label>
			<div class="controls">
				<input type="radio"  name="jsjtype"    value="0" checked="checked"/>接机
				<input type="radio"  name="jsjtype"    value="1"/>送机
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">抵达/出发机场：</label>
			<div class="controls">
				<input type="text" id="departcity_sitename3" class="display_ib flex_select1 date_3 span4 required" name="departsitename" 
					 placeholder="请选择机场" autocomplete="off" value="">
				<input type="hidden" name="departsite" value="">
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">出发/抵达地点：</label>
			<div class="controls">
				<input type="text" id="destcity_sitename3" data-autocity="yes" name="destsitename"
        			 class="apt-city required" placeholder="选择城市" autocomplete="off" value="">
				<input type="hidden" name="destsite"  id="destcity.siteid" value="">
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">上车地点：</label>
			<div class="controls">
				<input type="text"  name="boardaddr"  class="span4 required" id="suggestId" placeholder="请填写详细地址" value=""/>
				<div id="searchResultPanel" style="border:1px solid #C0C0C0;width:150px;height:auto; display:none;"></div>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">出发日期：</label>
			<div class="controls">
				<input type="text" placeholder="选择日期" class="Wdate span4 required" name="before" 
	  	   	  onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false,maxDate:'#F{$dp.$D(\'end\')}'});" id="before" readonly="readonly"/>
			&nbsp; - &nbsp;
				<input type="text" placeholder="选择日期" class="Wdate span4 required" name="end" 
	  	   	  onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false,minDate:'#F{$dp.$D(\'before\')}'});" id="end" readonly="readonly"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">出发时间：</label>
			<div class="controls">
				<input type="text" placeholder="选择日期" class="Wdate  required" name="deptime" 
	  	   	  onclick="WdatePicker({dateFmt:'HH:mm',isShowClear:false});" id="deptime" readonly="readonly"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">发布频率：</label>
			<div class="controls">
				<input type="checkbox"  name="every"  value="1" class="every"/>每天&nbsp;&nbsp;
				<input type="checkbox"  name="Mon"    value="1" class="One"/>周一&nbsp;&nbsp;
				<input type="checkbox"  name="Tue"    value="1" class="One"/>周二&nbsp;&nbsp;
				<input type="checkbox"  name="Wed"    value="1" class="One"/>周三&nbsp;&nbsp;
				<input type="checkbox"  name="Thu"    value="1" class="One"/>周四&nbsp;&nbsp;
				<input type="checkbox"  name="Fri"    value="1" class="One"/>周五&nbsp;&nbsp;
				<input type="checkbox"  name="Sat"    value="1" class="One"/>周六&nbsp;&nbsp;
				<input type="checkbox"  name="Sun"    value="1" class="One"/>周日
			</div>
		</div>
		<!-- <div class="control-group">
			<label class="control-label">截止时间：</label>
			<div class="controls">
				<input type="text" placeholder="选择日期" class="Wdate span4 required" name="enddate" 
	  	   	  onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:false});" id="coutm-time" readonly="readonly"/>
			</div>
		</div> -->
		<div class="control-group">
			<label class="control-label">车型：</label>
			<div class="controls">
				<select name="cargotype"  class="span4">
			<c:forEach items="${cargotypeList }" var="cargotype">
				<option value="${cargotype.cargotypeid }" >${cargotype.typename }</option>
			</c:forEach>
			</select>
			</div>	
		</div>
		<div class="control-group">
			<label class="control-label">总金额：</label>
			<div class="controls">
				<input type="number" min="0"  name="allprice"  class="span4 required" />
			</div>
		</div> 
		
		<div class="control-group">
			<label class="control-label">成团人数：</label>
			<div class="controls">
				<input type="number" min="1" name="minamount"  id="minamount" class="span4 required" />
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">最大参与人数：</label>
			<div class="controls">
				<input type="number" min="0" name="maxamount"  class="span4 required" />
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">联系人：</label>
			<div class="controls">
				<input type="text"   name="contacts" id="contacts" class="span4" />
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">联系电话：</label>
			<div class="controls">
				<input type="text"  name="phone" id="phone" class="span4 required">
			</div>
		</div>
		<div class="form-actions">
			<a href="javascript:void(0)" id="airportsearch">发布</a>&nbsp;
			<input id="btnCancel" class="btn" type="button" value="返 回"
				onclick="history.go(-1)" />
		</div>
	</form>
</body>
</html>
